package com.mf.entity.req.basic.webPage;

import com.mf.emuns.basic.EnumPageJsonType;
import com.mf.groups.GroupsAddInterface;
import com.mf.groups.GroupsUpdateInterface;
import com.mf.valid.ValidEnumValue;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Null;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;

/**
 * json格式配置提交
 */
@Data
public class ReqPageJsonConfig implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;
    @NotNull(message = "id不能为空", groups = {GroupsUpdateInterface.class})
    @Null(message = "新增id必须为空", groups = {GroupsAddInterface.class})
    private Integer id;

    @Schema(description = "名称")
    @NotBlank(message = "名称不能为空", groups = {GroupsAddInterface.class, GroupsUpdateInterface.class})
    private String cname;

    @Schema(description = "类型table:表格;form:表单;")
    @NotBlank(message = "类型不能为空", groups = {GroupsAddInterface.class, GroupsUpdateInterface.class})
    @ValidEnumValue(enumClass = EnumPageJsonType.class, groups = {GroupsAddInterface.class,
            GroupsUpdateInterface.class})
    private String type;

    @Schema(description = "json格式配置")
    @NotBlank(message = "json不能为空", groups = {GroupsAddInterface.class, GroupsUpdateInterface.class})
    private String json;

    @Schema(description = "排序")
    private Integer sort;


}
